home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / asmwiz10.arc / EXAMPLE.ASM < prev    next >
Assembly Source File  |  1990-04-06  |  9KB  |  175 lines

  1. comment #
  2.  
  3.    +----------------------------------------------------------------------+
  4.    |                                                                      |
  5.    |           ASMWIZ  Copyright (c) 1990  Thomas G. Hanlin III           |
  6.    |                                                                      |
  7.    |                          ASMWIZ Demo Program                         |
  8.    |                                                                      |
  9.    |              assembled with the excellent OPTASM by SLR              |
  10.    |                                                                      |
  11.    +----------------------------------------------------------------------+
  12.  
  13. #
  14.  
  15. Sseg          segment byte stack 'prog'     ; dummy stack segment
  16. Sseg          ends
  17.  
  18. Cseg          segment byte public 'prog'
  19.               assume cs:Cseg, ds:Cseg, ss:Sseg
  20.  
  21.               org            100h
  22.  
  23.  
  24.  
  25. extn  MV_INIT, MV_LOCATE, MV_MODE, MV_POPUP, MV_STROUT
  26. extn  MV_HIDECURSOR, MV_STROUT, MV_INSLINE, MV_DELLINE
  27. extn  MV_INSCHR, MV_DELCHR, MV_COLOR
  28. extn  S0_LENGTH, MD_TICK
  29.  
  30. ; MASM/TASM programs should say "EXTRN  MV_INIT:NEAR, MV_LOCATE:NEAR" (etc)
  31. ; instead.  The "EXTN" statement is an OPTASM abbreviation for all that.
  32.  
  33.  
  34.  
  35. MAIN          proc           far
  36.               call           MV_INIT        ; initialize display routines
  37.               mov            al,3           ; mode 3: 80x25 color text
  38.               call           MV_MODE        ; set display mode
  39.               call           MV_HIDECURSOR  ; turn off the cursor
  40.               mov            dx,0125h       ; row 1, column 37
  41.               call           MV_LOCATE      ; set cursor location
  42.               lea            dx,WelcomeMsg  ; ptr to "Welcome"
  43.               call           MV_STROUT      ; display it
  44.               mov            cx,8           ;
  45. Welcome1:     call           MV_INSLINE     ; scroll it down
  46.               push           cx             ;
  47.               mov            cx,1           ;
  48.               call           MD_TICK        ; delay an 18th of a second
  49.               pop            cx             ;
  50.               loop           Welcome1       ; ...nine times
  51.               mov            dx,0B25h       ; row 11, column 37
  52.               call           MV_LOCATE      ; set cursor location
  53.               lea            dx,ToTheMsg    ; ptr to "to the"
  54.               call           MV_STROUT      ; display it
  55.               mov            dx,0D01h       ; row 13, column 1
  56.               call           MV_LOCATE      ; set cursor location
  57.               lea            dx,AsmMsg      ; ptr to "ASM" <cr>
  58.               call           MV_STROUT      ; display it
  59.               mov            cx,37          ;
  60. Welcome2:     call           MV_INSCHR      ; scroll it right
  61.               push           cx             ;
  62.               mov            cx,1           ;
  63.               call           MD_TICK        ; delay an 18th of a second
  64.               pop            cx             ;
  65.               loop           Welcome2       ; ...37 times
  66.               mov            dx,0D4Dh       ; row 13, column 73
  67.               call           MV_LOCATE      ;
  68.               lea            dx,WizMsg      ; ptr to "WIZ"
  69.               call           MV_STROUT      ; display it
  70.               mov            dx,0D29h       ; row 13, column 41
  71.               call           MV_LOCATE      ; set cursor location
  72.               mov            cx,36          ;
  73. Welcome3:     call           MV_DELCHR      ; scroll it left
  74.               push           cx             ;
  75.               mov            cx,1           ;
  76.               call           MD_TICK        ; delay an 18th of a second
  77.               pop            cx             ;
  78.               loop           Welcome3       ; ...36 times
  79.               mov            dx,1925h       ; row 25, column 37
  80.               call           MV_LOCATE      ; set cursor location
  81.               lea            dx,LibraryMsg  ; ptr to "Library"
  82.               call           MV_STROUT      ; display it
  83.               mov            dx,0E01h       ; row 14, column 1
  84.               call           MV_LOCATE      ; set cursor location
  85.               mov            cx,10          ;
  86. Welcome4:     call           MV_DELLINE     ; scroll it up
  87.               push           cx             ;
  88.               mov            cx,1           ;
  89.               call           MD_TICK        ; delay an 18th of a second
  90.               pop            cx             ;
  91.               loop           Welcome4       ; ...10 times
  92.  
  93.               mov            dx,0901h       ; row 9, column 1
  94.               mov            ax,4           ;
  95. ScrollAll:    mov            cx,20          ; columns to scroll
  96. LineLeft:     call           MV_LOCATE      ; set cursor position
  97.               call           MV_DELCHR      ; scroll it left
  98.               loop           LineLeft       ;   go for all columns
  99.               add            dh,2           ; move to next line
  100.               dec            ax             ; done yet?
  101.               jnz            ScrollAll      ;   no, go for next row
  102.  
  103.               lea            dx,ScrWindow   ;
  104.               call           MV_POPUP       ; pop up intro window
  105.               lea            si,WindowText  ; pointer to window text
  106.               mov            dx,word ptr ScrWindow
  107.               xchg           dl,dh          ;
  108.               add            dx,0102h       ; starting text position
  109.  
  110. ShowWindow:   call           MV_LOCATE      ; set cursor position
  111.               call           S0_LENGTH      ; determine length of text
  112.               jcxz           WaitOnKey      ;   if zero, go exit
  113.               xchg           dx,si          ;
  114.               call           MV_STROUT      ; display the text
  115.               xchg           dx,si          ;
  116.               add            si,cx          ; move to next text line
  117.               inc            si             ;
  118.               inc            dh             ; move to next screen line
  119.               jmp            ShowWindow     ;   go for all text
  120.  
  121. WaitOnKey:    mov            dx,191Bh       ; row 25, column 26
  122.               call           MV_LOCATE      ; set cursor location
  123.               mov            al,70h         ; inverse video
  124.               call           MV_COLOR       ;
  125.               lea            dx,PressAnyMsg ; ptr to "Press any key..."
  126.               call           MV_STROUT      ; display it
  127.               mov            al,07h         ; normal video
  128.               call           MV_COLOR       ;
  129.               mov            ah,7           ; get a key
  130.               int            21h            ;
  131.               or             al,al          ; is it extended?
  132.               jnz            Done           ;   no, continue
  133.               mov            ah,7           ; get the rest of the key
  134.               int            21h            ;
  135.  
  136. Done:         mov            ax,4C00h
  137.               int            21h            ; exit program
  138. MAIN          endp
  139.  
  140.  
  141.  
  142. WelcomeMsg   db "Welcome",0
  143. ToTheMsg     db "to the",0
  144. AsmMsg       db "ASM",13,0
  145. WizMsg       db "WIZ",0
  146. LibraryMsg   db "Library",0
  147. PressAnyMsg  db "Press any key to continue",0
  148.  
  149. ScrWindow    db 3,40,24,80        ; window coordinates
  150.              db 1,7               ; frame type and color
  151.              dw offset ScrTitle   ; pointer to title
  152. ScrTitle     db "The Assembly Wizard's Library",0   ; window title
  153.  
  154. WindowText   db "Since you're evidently an assembly",0
  155.              db "language programmer and may be",0
  156.              db "considered reasonably sophisticated,",0
  157.              db "I'll skip the sales pitch here and",0
  158.              db "just list a few of the capabilities",0
  159.              db "of the ASMWIZ library:",0
  160.              db " ",0
  161.              db "DOS, BIOS, and machine-level display",0
  162.              db "Base conversions (integer and long)",0
  163.              db "Long integer math support",0
  164.              db "Delay and countdown services",0
  165.              db "Pseudo-random number generation",0
  166.              db "File matching, command-line parsing",0
  167.              db "Environment scanning",0
  168.              db "String functions",0
  169.              db "Mouse support and sound generation",0
  170.              db "Checksum and CRC calculation",0
  171.              db "International time and date support",0,0
  172.  
  173. Cseg          ends
  174.               end            MAIN
  175.